home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / PrintManager.h < prev    next >
C/C++ Source or Header  |  1992-06-01  |  3KB  |  128 lines

  1. #ifndef PrintManager_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define PrintManager_First
  7.  
  8. #include "Dialog.h"
  9.  
  10. class PrintDialog;
  11. class PrintPort;
  12. class Printer;
  13. class OrdCollection;
  14. class Printer;
  15.  
  16. //---- PrinterSettings ------------------------------------------------------------
  17.  
  18. class PrinterSettings : public Object {
  19. public:
  20.     Point paperSize, topLeftMargin, bottomRightMargin;
  21.     char *name;
  22.     bool showgrid;
  23. public:
  24.     MetaDef(PrinterSettings);
  25.     PrinterSettings(Point ps, Point tlm, Point brm, Rectangle pr);
  26.     ~PrinterSettings();
  27.     
  28.     char *GetName()
  29.     { return name; }
  30.     void SetPaperSize(Point);
  31.     Point GetPaperSize()
  32.     { return paperSize; }
  33.     void SetTopLeftMargin(Point tlm);
  34.     Point GetTopLeftMargin()
  35.     { return topLeftMargin; }
  36.     void SetBottomRightMargin(Point brm);
  37.     Point GetBottomRightMargin()
  38.     { return bottomRightMargin; }
  39.     Rectangle GetPrintRect();
  40.     Rectangle GetViewRect();
  41.     void ShowPageBreaks(bool mode);
  42.     bool GetShowPageBreaks()
  43.     { return showgrid; }
  44.     Printer *GetPrinter();
  45.  
  46.     OStream& PrintOn(OStream&);
  47.     IStream& ReadFrom(IStream&);
  48. };
  49.  
  50. //---- PrintManager ------------------------------------------------------------
  51.  
  52. class PrintManager : public Object {
  53. public:
  54.     OrdCollection *printers;
  55.     PrinterSettings *currSettings;
  56.     Printer *currPrinter;
  57.     VObject *vobject;
  58.        
  59. public:
  60.     MetaDef(PrintManager);
  61.     
  62.     PrintManager();
  63.     ~PrintManager();
  64.     
  65.     void InstallPrinter(char *name);
  66.  
  67.     Printer *PrinterAt(int no);
  68.     int PrinterId(Printer*);
  69.     
  70.     void SetPaperSize(Point ps)
  71.     { currSettings->SetPaperSize(ps); }
  72.     Point GetPaperSize()
  73.     { return currSettings->GetPaperSize(); }
  74.  
  75.     void SetTopLeftMargin(Point tlm)
  76.     { currSettings->SetTopLeftMargin(tlm); }
  77.     Point GetTopLeftMargin()
  78.     { return currSettings->GetTopLeftMargin(); }
  79.  
  80.     void SetBottomRightMargin(Point brm)
  81.     { currSettings->SetBottomRightMargin(brm); }
  82.     Point GetBottomRightMargin()
  83.     { return currSettings->GetBottomRightMargin(); }
  84.  
  85.     Rectangle GetPrintRect()
  86.     { return currSettings->GetPrintRect(); }
  87.     
  88.     Printer *GetPrinter()
  89.     { return currPrinter; }
  90.     
  91.     Rectangle GetViewRect()
  92.     { return currSettings->GetViewRect(); }
  93.     
  94.     void ShowPageBreaks(bool mode);
  95.     bool GetShowPageBreaks(VObject *vop);
  96.  
  97.     Printer *FindPrinter(char *name);
  98.  
  99.     virtual PrintDialog *MakePrintDialog();
  100.     void Print(char*, int from, int to);
  101.     void ShowPageGrid(Rectangle r, VObject *);
  102.     void ShowPrintDialog(VObject *v);
  103.     virtual void PrintPage(int np, PrintPort *printport, Rectangle pgr);
  104. };
  105.  
  106. //---- SmartPrintManager -------------------------------------------------------
  107.  
  108. class SmartPrintManager {
  109.     class PrintManager *pm;
  110. public:
  111.     SmartPrintManager()
  112.     { }
  113.     ~SmartPrintManager()
  114.     { SafeDelete(pm); }
  115.     PrintManager *MakePrintManager();
  116.     operator PrintManager* ()
  117.     { return MakePrintManager(); }
  118.     PrintManager* operator-> ()
  119.     { return MakePrintManager(); }
  120. };
  121.  
  122. extern SmartPrintManager gPrintManager;
  123.  
  124. extern bool gPrinting;
  125.  
  126. #endif
  127.  
  128.